package random.fox.p2p.presenter;

import random.fox.p2p.interactors.MessageInteractor;
import random.fox.p2p.interactors.OnAddActionListener;
import random.fox.p2p.view.IReplyVierw;

/**
 * Created by acer on 2015/4/6.
 */
public class ReplyPresenterImpl implements ReplyPresenter ,OnAddActionListener{

    private IReplyVierw iReplyVierw;
    private MessageInteractor interactor;

    public ReplyPresenterImpl(IReplyVierw iReplyVierw , MessageInteractor interactor){
        this.iReplyVierw = iReplyVierw;
        this.interactor = interactor;
    }

    @Override
    public void addReply(int mid, String content) {
        iReplyVierw.showProgress();
        interactor.addReply(mid , content ,this );
    }

    @Override
    public void onSuccess() {
        interactor.releaseHotData();
        iReplyVierw.hideProgress();
        iReplyVierw.showMessage("评论成功");
        iReplyVierw.goBack();
    }

    @Override
    public void onError(Throwable t) {
        iReplyVierw.hideProgress();
        iReplyVierw.showMessage("onError");
    }
}
